# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1FeatureMap do
  @moduledoc """
  FeatureMap represents extra features that customers want to include in the recommendation model for catalogs/user events as categorical/numerical features.

  ## Attributes

  *   `categoricalFeatures` (*type:* `%{optional(String.t) => GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1FeatureMapStringList.t}`, *default:* `nil`) - Categorical features that can take on one of a limited number of possible values. Some examples would be the brand/maker of a product, or country of a customer. Feature names and values must be UTF-8 encoded strings. For example: `{ "colors": {"value": ["yellow", "green"]}, "sizes": {"value":["S", "M"]}`
  *   `numericalFeatures` (*type:* `%{optional(String.t) => GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1FeatureMapFloatList.t}`, *default:* `nil`) - Numerical features. Some examples would be the height/weight of a product, or age of a customer. Feature names must be UTF-8 encoded strings. For example: `{ "lengths_cm": {"value":[2.3, 15.4]}, "heights_cm": {"value":[8.1, 6.4]} }`
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :categoricalFeatures =>
            %{
              optional(String.t()) =>
                GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1FeatureMapStringList.t()
            }
            | nil,
          :numericalFeatures =>
            %{
              optional(String.t()) =>
                GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1FeatureMapFloatList.t()
            }
            | nil
        }

  field(:categoricalFeatures,
    as:
      GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1FeatureMapStringList,
    type: :map
  )

  field(:numericalFeatures,
    as:
      GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1FeatureMapFloatList,
    type: :map
  )
end

defimpl Poison.Decoder,
  for:
    GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1FeatureMap do
  def decode(value, options) do
    GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1FeatureMap.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for:
    GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1FeatureMap do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
